<template>
	<BasicModal v-bind="$attrs" z-index="1000" style="z-index:999" @register="registerModal" title="请选择行程"
		@ok="confirmCombinedJounery" :helpMessage="['提示', '选择车辆']">
		<BasicForm @register="registerForm">

		</BasicForm>
	</BasicModal>
</template>
<script lang="ts" setup>
	import { defineComponent, ref, unref, inject } from 'vue';
	import { boundVehicle } from '../../CoupleActivityCarpoolBus.api';
	import { bindCarUpdateModuleSchema } from '../../CoupleActivityCarpoolBus.data';
	import { useMessage } from '/@/hooks/web/useMessage';
	import { BasicForm, useForm } from '/@/components/Form/index';
	import { BasicModal, useModalInner } from '/@/components/Modal';
	const emit = defineEmits(['register', 'successConfirm']);
	const mainId = inject('mainId') || '';
	const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
		setModalProps({ zIndex: 1000 })
	})
	const [registerForm, { setProps, resetFields, setFieldsValue, validate }] = useForm({
		//labelWidth: 150,
		schemas: bindCarUpdateModuleSchema,
		showActionButtonGroup: false,
		baseColProps: { span: 24 }
	});


	async function confirmCombinedJounery() {
		let values = await validate();
		if (unref(mainId)) {
			values['carpoolBus'] = unref(mainId);
		}
		//提交表单
		await boundVehicle(values);
		
		closeModal();
		//刷新主界面内容
		//刷新列表
		emit('success');

	}
</script>

<style>

</style>